package com.help10000.rms.ui.activitys

import android.content.Intent
import android.os.Bundle
import com.alibaba.sdk.android.push.AndroidPopupActivity
import com.amir.common.utils.LogUtils
import com.help10000.rms.R
import com.help10000.rms.common.PushExtraHelper
import com.help10000.rms.config.globalData
import com.help10000.rms.ui.utils.JsonUtils

class MessageEntranceActivity : AndroidPopupActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_message_entrance)
    }

    override fun onSysNoticeOpened(
        title: String?,
        summary: String?,
        extMap: MutableMap<String, String>
    ) {
        LogUtils.E("OnSysNoticeOpened, title: $title, content: $summary, extMap: $extMap");
        var content = JsonUtils.getString(extMap);
        if (!content.isNullOrEmpty()) {
            if (globalData.Cmpy != null) {
                PushExtraHelper.handlePush(this, content);
            } else {
                var intent = Intent(this, SplashActivity::class.java)
                intent.putExtra("push_content", content)
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
                startActivity(intent)
            }
        }
        finish()
    }
}